﻿using System;
using System.Collections.Generic;
using System.Text;

namespace RST
{
    public partial class UserBase:BaseRST
    {
        protected override Model.RST<T> GetRSTObject<T>(string Action, object Query)
        {
            return GetRSTObject<T>("UserBase", Action, Query);
        }

        public Model.UserBase Single(Model.UserBase UserBase)
        {
            Model.RST<Model.UserBase> rsp = GetRSTObject<Model.UserBase>("single", UserBase);
            if (rsp.RSTCode == Model.RSTStatusCode.OK)
            {
                return rsp.RSTData;
            }
            return null;
        }

        public Model.UserBase Insert(Model.UserBase UserBase)
        {
            Model.RST<Model.UserBase> rsp = GetRSTObject<Model.UserBase>("insert", UserBase);
            if (rsp.RSTCode == Model.RSTStatusCode.OK)
            {
                return rsp.RSTData;
            }
            return null;
        }

        public bool Delete(Model.UserBase UserBase)
        {
            Model.RST<int> rsp = GetRSTObject<int>("delete", UserBase);
            if (rsp.RSTCode == Model.RSTStatusCode.OK)
            {
                return rsp.RSTData > 0 ? true : false;
            }
            return false;
        }

        public bool Update(Model.UserBase UserBase)
        {
            Model.RST<int> rsp = GetRSTObject<int>("update", UserBase);
            if (rsp.RSTCode == Model.RSTStatusCode.OK)
            {
                return rsp.RSTData > 0 ? true : false;
            }
            return false;
        }

        public List<Model.UserBase> List(Model.Search.UserBaseList ubl)
        {
            Model.RST<List<Model.UserBase>> rsp = GetRSTObject<List<Model.UserBase>>("arraylist", ubl);
            if (rsp.RSTCode == Model.RSTStatusCode.OK)
            {
                return rsp.RSTData;
            }
            return null;
        }
    }
}